package eerbaar.shared.internal.tree.commands;

import eerbaar.shared.tree.INode;

public class GetLastChildCmd {

    private final INode start;

    public GetLastChildCmd(INode start) {
        this.start = start;
    }

    public INode execute() {

        assert (this.start != null);

        INode result = null;

        INode[] children = this.start.getChildren();
        if (children.length > 0) {
            result = children[children.length - 1];
        }

        return result;
    }

}
